/**
 * @file    Expression classname is undefined on line 2, column 15 in Templates/Classes/Class.java.
 * @author  Haseeb Yousaf
 * @see     LICENSE (MIT style license file)
 * @version 1.0
 * @date    Nov 22, 2011 5:57:29 PM
 */
package carrello.model.entitydao;
import java.util.Set;
import java.util.List;
import carrello.model.entities.*;
import static carrello.util.EntityManagerUtil.getEntityManager;
public class CompanyDAO {
        public void create(Company c)
    {
        getEntityManager().beginUnitOfWork();
        getEntityManager().store(c);
        getEntityManager().endUnitOfWork();
    }
    
    public void createAll(Set<Company> c)
    {
        getEntityManager().beginUnitOfWork();
        getEntityManager().storeAll(c);
        getEntityManager().endUnitOfWork();
    }
    
    public Company getByName(String name)
    {
        return Company.getCompanyByName();
    }
    
    public Company getCompany()
    {
        return Company.getCompanyByName();
    }
    
    public void delete(Company c)
    {
        getEntityManager().beginUnitOfWork();
        getEntityManager().remove(c);
        getEntityManager().endUnitOfWork();
    }
    
       public void deleteAll(Set<Company> c)
    {
        getEntityManager().beginUnitOfWork();
        getEntityManager().removeAll(c);
        getEntityManager().endUnitOfWork();
    }
}
